import Vue from 'vue'
import VueRouter from 'vue-router'
import Login from '../components/Login.vue'
import Home from '../components/Home.vue'
import welcome from '../components/welcome.vue'
import Users from '../components/right/user.vue'


Vue.use(VueRouter)

  const routes = [
    {path:'/', redirect:'/login'},
    {path:'/login', component:Login},
    {
      path:'/home',
     component:Home,
     redirect:'/welcome',
    children:[{path:'/welcome',component:welcome},{path:'/users',component:Users}]
  }
]

const router = new VueRouter({
  routes
})

// //挂载路由导航守卫
// router.beforeEach(((to,from,next)=>{
//   //to将要访问
//   //from哪个路径转过来
//   //next表示放行
// if(to.path=='/login') return next();


// }))

export default router
